<?php
/* FOOTER FUNCTIONS */

function printFooter($cnn, $select = 0, $index = false) {
    ?>
    <div id="repeat-v"></div>

    <?php if ($index): ?>
        <div id="footer-csme">
            <div class="center">
                <h2>LE CSME, Club Sportif Multisections d’Epinay-sur-Seine</h2>
                <?php 
                    $sql = '
                        SELECT `txt_le_csme` FROM `tbl_presentation` 
                        WHERE int_id_presentation = 1
                        LIMIT 1
                    ';
                    $row = mysql_fetch_assoc(mysql_query($sql, $cnn));
                ?>
                <p><?= JLTools::getInstance()->shorterString($row['txt_le_csme'], 425) ?></p>
                <a class="buttonlink bxshd" href="presentation.html">Lire la suite</a>
            </div>
        </div>

    <?php endif; ?>

    <?php
    $tips = printTooltips($cnn);
    echo $tips['slider']['tips'];
    echo $tips['popup']['tips'];
    ?>

    <div id="footer-partenaires">
        <div id="fpartenaires">
            <h3>NOS PARTENAIRES</h3>
            <p>
                Retrouvez tous nos partenaires affiliés au CSME.
            </p>

            <div class="flexslider">
                <ul class="slides">
                    <?php echo $tips['slider']['slides']; ?>
                </ul>
            </div>
        </div>
                            <div class="fldbtm"></div>                    

    </div>


    <div id="popup-partenaires">
        <div id="part-nav"></div>
        <div class="part-01"></div>
        <div class="part-02">
            <div class="part-content">

                <div class="coda-slider preload" id="sliderPartenaires">
                    <?php echo $tips['popup']['slides']; ?>
                </div>

            </div>
        </div>
        <div class="part-03"></div>
    </div>


    <?php echo $tips['slider']['script']; ?>
    <?php echo $tips['popup']['script']; ?>



    <!-- BN FOOTER -->
    <div id="footer">
        <div id="ftop">
            <div id="ftop-wrap">
                <div class="fgroup first">
                    <h3>Présentation</h3>
                    <ul>
                        <li><a href="presentation.html">Le CSME</a></li>
                        <li><a href="administration.html">Administration</a></li>
                        <li><a href="contacts.html">Contacts</a></li>
                    </ul>
                </div>
                <div class="fgroup small">
                    <h3>Les Sections</h3>
                    <ul>
                        <li><a<?php if ($select == 1): ?> class="selected"<?php else: ?> href="section.html?id=1"<?php endif; ?>>Arts Martiaux</a></li>
                        <li><a<?php if ($select == 2): ?> class="selected"<?php else: ?> href="section.html?id=2"<?php endif; ?>>Athlétisme</a></li>
                        <li><a<?php if ($select == 3): ?> class="selected"<?php else: ?> href="section.html?id=3"<?php endif; ?>>Basketball</a></li>
                        <li><a<?php if ($select == 5): ?> class="selected"<?php else: ?> href="section.html?id=5"<?php endif; ?>>Boxe Française</a></li>
                        <li><a<?php if ($select == 6): ?> class="selected"<?php else: ?> href="section.html?id=6"<?php endif; ?>>Colombophilie</a></li>
                        <li><a<?php if ($select == 7): ?> class="selected"<?php else: ?> href="section.html?id=7"<?php endif; ?>>Culturisme</a></li>
                        <li><a<?php if ($select == 8): ?> class="selected"<?php else: ?> href="section.html?id=8"<?php endif; ?>>Cyclisme</a></li>
                        <li><a<?php if ($select == 9): ?> class="selected"<?php else: ?> href="section.html?id=9"<?php endif; ?>>Cyclotourisme</a></li>
                        <li><a<?php if ($select == 10): ?> class="selected"<?php else: ?> href="section.html?id=10"<?php endif; ?>>Echecs</a></li>
                        <li><a<?php if ($select == 11): ?> class="selected"<?php else: ?> href="section.html?id=11"<?php endif; ?>>Escalade</a></li>
                        <li><a<?php if ($select == 12): ?> class="selected"<?php else: ?> href="section.html?id=12"<?php endif; ?>>Escrime</a></li>
                        <li><a<?php if ($select == 13): ?> class="selected"<?php else: ?> href="section.html?id=13"<?php endif; ?>>Gym Entretien</a></li>
                    </ul>
                </div>
                <div class="fgroup small notitle">
                    <ul>
                        <li><a<?php if ($select == 14): ?> class="selected"<?php else: ?> href="section.html?id=14"<?php endif; ?>>Gym Tonic</a></li>
                        <li><a<?php if ($select == 15): ?> class="selected"<?php else: ?> href="section.html?id=15"<?php endif; ?>>Gym Artistique</a></li>
                        <li><a<?php if ($select == 16): ?> class="selected"<?php else: ?> href="section.html?id=16"<?php endif; ?>>Marche Randonnée</a></li>
                        <li><a<?php if ($select == 17): ?> class="selected"<?php else: ?> href="section.html?id=17"<?php endif; ?>>Muay Thaï</a></li>
                        <li><a<?php if ($select == 18): ?> class="selected"<?php else: ?> href="section.html?id=18"<?php endif; ?>>Natation</a></li>
                        <li><a<?php if ($select == 19): ?> class="selected"<?php else: ?> href="section.html?id=19"<?php endif; ?>>Pétanque</a></li>
                        <li><a<?php if ($select == 20): ?> class="selected"<?php else: ?> href="section.html?id=20"<?php endif; ?>>Plongée Sous Marine</a></li>
                        <li><a<?php if ($select == 21): ?> class="selected"<?php else: ?> href="section.html?id=21"<?php endif; ?>>Tennis / Badminton</a></li>
                        <li><a<?php if ($select == 22): ?> class="selected"<?php else: ?> href="section.html?id=22"<?php endif; ?>>Tir à l'arc</a></li>
                        <li><a<?php if ($select == 23): ?> class="selected"<?php else: ?> href="section.html?id=23"<?php endif; ?>>Volley Ball</a></li>
                        <li><a<?php if ($select == 24): ?> class="selected"<?php else: ?> href="section.html?id=24"<?php endif; ?>>Yoga</a></li>
                    </ul>
                </div>
                <div class="fgroup left">
                    <h3>Act. CSME</h3>
                    <ul>
                        <?php
                        $sql = "SELECT 
                          var_monthyear
                        FROM 
                          tbl_actualites
                        WHERE int_id_section < 3 && int_id_section !=0 && int_id_state != 3
                        GROUP BY var_monthyear
                        ORDER BY int_actualite DESC
                        LIMIT 12";
                        $resr = mysql_query($sql, $cnn);
                        $i = 1;
                        while ($row = mysql_fetch_assoc($resr)):
                            if ($i < 13):
                                ?>
                                <li><a href="actualites.html#<?php echo $i; ?>"><?php echo $row['var_monthyear']; ?></a></li>
                                <?php
                                $i++;
                            else:
                                break;
                            endif;
                        endwhile;
                        ?>
                    </ul>
                </div>

                <div class="fgroup last">
                    <h3>Documentation</h3>
                    <ul>
                        <li><a href="pdf/reglement_financier_csme.pdf" target="_blank">Règlement Financier</a></li>
                        <li><a href="pdf/reglement_interieur_csme.pdf" target="_blank">Règlement Interieur</a></li>
                        <li><a href="pdf/statuts_csme.pdf" target="_blank">Statuts CSME</a></li>
                    </ul>

                    <div class="sharing">
                        <h3>Suivez-nous</h3>
                        <ul>
                            <li class="fb"><a href="http://www.facebook.com/CSMEpinaysurSeine" target="_blank" title="Facebook CSME">Facebook CSME</a></li>
                            <li class="rss"><a href="http://feed.csme.fr/" target="_blank" title="CSME RSS Feed">CSME RSS Feed</a></li>
                        </ul>
                    </div>
                </div>
            </div>

            <div id="copy">
                <div class="copy-text">
                    &copy; <?php echo date('Y'); ?> Club Sportif Multisections d'Epinay-sur-Seine. Tous droits réservés.
                </div>
            </div>

        </div>


        <div id="connection">
            <div id="concontent">
                <span id="cncontrol" title="Ouvrir"><span></span></span>

                <div class="cndata">
                    <div class="cnpanel first">
                        <span id="txtmessage"></span>
                        <h3>Connection</h3>
                        <?php if (isLogged()): ?>
                            <input id="txtlogin" type="text" autocomplete="off" disabled value="<?php echo $_SESSION['_var_username']; ?>" />
                            <input id="txtpassword" type="password" autocomplete="off" disabled value="Password" />
                            <button onclick="javascript:document.location='administration/';">Continuer &raquo;</button>
                        <?php else: ?>
                            <form id="frmcn" action="./" method="post" enctype="application/x-www-form-urlencoded">
                                <input id="txtlogin" type="text" name="_login" autocomplete="off" />
                                <input id="txtpassword" type="password" name="_pwd" autocomplete="off" />
                                <input type="submit" value="Se connecter" />
                            </form>
                        <?php endif; ?>
                    </div>

                    <div class="cnpanel second">
                        <h3>Le CSME</h3>
                        <p>
                            Le sport, on l’aime pour les exploits qu’il nous offre, pour l’atmosphère qu’il créé, et plus encore, pour les valeurs qu’il porte.
                            Le CSME, c’est un peu tout cela à la fois : une fédération d’associations sportives aussi performantes que conviviales, dont les membres s’efforcent de proposer aux Spinassiennes et aux Spinassiens la meilleure offre d’activités possible.

                            Pour les mois à venir, je leur adresse, au nom du Conseil municipal d’Epinay-sur-Seine, mes encouragements les plus sincères.   </p>
                        <strong class="visites">Nombre de visites : <?php include_once "5G7KsI3Utn55YukQyNtAqU44/index.php"; ?></strong>

                    </div>

                    <div class="cnpanel third">
                        <h3>Credits</h3>
                        <a href="http://www.lbnstudio.fr/" target="_blank" title="Développement LBN Studio"><img width="63" height="30" src="images/lbn.png" /></a>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!-- END BN FOOTER -->


    <div id="msg-newletter">
        <div class="msg-txt">
            <strong>Merci !</strong> <br />
            <span>Vous recevrez notre newsletter avec les dernières news du CSME. A bientôt !</span>
        </div>
    </div>


    <div id="msg-newletter2" class="msgbox alert">
        <div class="msg-txt">
            <strong>Avertissement</strong> <br />
            <span>Oups ! L'e-mail indiqué est déjà enregistré<br />dans notre base.</span>
        </div>
    </div>
    <?php
}

function printMyVisites() {
    ?>
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-9244484-6']);
        _gaq.push(['_setDomainName', 'csme.fr']);
        _gaq.push(['_trackPageview']);
        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
    </script>
    <?php
}

function printTooltips($cnn) {
    $sql = "SELECT 
	  tbl_partenaires.id_int_partenaire,
	  tbl_partenaires.int_page,
	  tbl_logos.var_title,
	  tbl_logos.txt_description,
	  tbl_logos.var_link,
	  tbl_logos.var_src,
	  tbl_logos.var_size,
	  tbl_logos.int_order,
	  tbl_logos.int_id_logo
	FROM
	  tbl_partenaires
	  INNER JOIN tbl_logos ON (tbl_partenaires.id_int_partenaire = tbl_logos.id_int_partenaire)
	WHERE tbl_logos.int_id_state <> 3  AND tbl_logos.id_int_partenaire <> 0
	ORDER BY
	  tbl_partenaires.int_page,
	  tbl_logos.int_order
        LIMIT 400";

    $res = mysql_query($sql, $cnn);
    $p = 0;
    $tooltips = $tooltips2 = $tooltiphtml = $tooltiphtml2 = $panel = $panel2 = "";

    while ($row = mysql_fetch_assoc($res)) {
        $page = intval($row['int_page']);
        $src = $row['var_src'];
        $link = $row['var_link'];
        $size = explode("x", $row['var_size']);
        $idlogo = $row['int_id_logo'];
        $idlogo2 = $idlogo . '-popup';
        $description = $row['txt_description'];
        $terminate = "";
        $terminate2 = "";

        if ($page != $p || $p == 0) {
            if ($p > 0) {
                $terminate = '</li>';
                $terminate2 = '</div></div>';
                $panel .= $terminate;
                $panel2 .= $terminate2;
            }

            $p++;

            $panel .= '<li>';
            $panel2 .= '<div class="panel">
				<span class="title">' . $page . '</span>
				<div class="panel-wrapper">';
        }

        if ($page == $p) {
            $tooltiphtml .= '
            <div id="t-tooltip' . $idlogo . '" class="tooltiplogo">
                <div class="t-top"></div>
                <div class="t-middle">
                        <img src="images/escudo.png" width="14" height="16"><span class="t-title">Info:</span><br />
                        ' . str_replace("\n", "<br />", $description) . (($link) ? '<br /><span class="t-link">--<br /><a href="' . $link . '" target="_blank">Voir site web</a><br />--</span>' : '') . '							
                </div>
                <div class="t-bottom"></div>
            </div>';

            $tooltiphtml2 .= '<div id="t-tooltip' . $idlogo2 . '" class="tooltiplogo">
                    <div class="t-top"></div>
                    <div class="t-middle">
                            <img src="images/escudo.png" width="14" height="16"><span class="t-title">Info:</span><br />
                            ' . str_replace("\n", "<br />", $description) . (($link) ? '<br /><span class="t-link">--<br /><a href="' . $link . '" target="_blank">Voir site web</a><br />--</span>' : '') . '							
                    </div>
                    <div class="t-bottom"></div>
            </div>';

            $tooltips .= "$(\"#t-image" . $idlogo . "\").tooltip({tip: \"#t-tooltip" . $idlogo . "\", tipClass: \"tooltiplogo\", offset: [-2, 10]}); ";
            $tooltips2 .= "$(\"#t-image" . $idlogo2 . "\").tooltip({tip: \"#t-tooltip" . $idlogo2 . "\", tipClass: \"tooltiplogo\", offset: [-2, 10]}); ";

            $image = '<div class="part-logo">';
            $image .= (($link) ? '<a href="' . $link . '" target="_blank">' : '') . '<img class="t-image-logos" id="t-image' . $idlogo . '" width="' . $size[0] . '" height="' . $size[1] . '" src="images/logos/' . $src . '" /> ' . (($link) ? '</a>' : '');
            $image .= '</div>';
            $panel .= $image;

            $image = (($link) ? '<a href="' . $link . '" target="_blank">' : '') . '<img class="t-image-logos" id="t-image' . $idlogo2 . '" width="' . $size[0] . '" height="' . $size[1] . '" src="images/logos/' . $src . '" /> ' . (($link) ? '</a>' : '');
            $panel2 .= $image;
        }
    }

    if ($p > 0) {
        $terminate = '</li>';
        $panel .= $terminate;
        $terminate2 = '</div></div>';
        $panel2 .= $terminate2;
    }

    return array(
        'slider' => array(
            'slides' => $panel,
            'tips' => $tooltiphtml,
            'script' => "<script type=\"text/javascript\">$(function(){" . $tooltips . "});</script>"),
        'popup' => array(
            'slides' => $panel2,
            'tips' => $tooltiphtml2,
            'script' => "<script type=\"text/javascript\">$(function(){" . $tooltips2 . "});</script>"),
    );
}

function printAutoScroll($ip) {
    ?>
    <script type="text/javascript">var _ip='<?php echo $ip; ?>';
    <?php if (isset($_GET['act'])): ?>
            var an={init:function(a){var e="#"+a,d=$(e).offset().top;$("html:not(:animated),body:not(:animated)").animate({scrollTop:d},1100);}};$(function(){var _linke="act<?php echo $_GET['act']; ?>";an.init(_linke);});
    <?php endif; ?>
    </script>
    <?php
}

function printAutoScrollSection($ip) {
    ?>
    <script type="text/javascript">var _ip='<?php echo $ip; ?>';
    <?php
    if (!empty($_GET['act'])):
        ?>
                var an={init:function(a){var e="#"+a,d=$(e).offset().top;$("html:not(:animated),body:not(:animated)").animate({scrollTop:d},1100);}};$(function(){var _linke="act<?php echo $_GET['act'] ?>";if(actualites_tab == parseInt(location.hash.slice(1))){an.init(_linke);}});
        <?php
    endif;
    ?>
    </script>
    <?php
}
?>